#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#define PI acos(-1.0)
#define lowerlimit 0
#define upperlimit PI*2
#define secnum 10000000
double func(double x)
{
	return cos(x);
}
int main(int argc, char const *argv[])
{
	int i;
	start = clock();
	clock_t start, finish;
	double ret, eachlen, duration;
	eachlen = (upperlimit - lowerlimit)/(double)secnum;
	ret = 0;
	for(i=1; i<=secnum; i++)
		ret += eachlen * func(lowerlimit + eachlen*i);
	finish = clock();
 	duration = (double)(finish - start) / CLOCKS_PER_SEC;  
 	printf("%lf\n", ret);
 	printf("%lf\n", duration);
	return 0;
}